package findtextinfile;

import java.io.File;
import java.util.Scanner;
/** 
Am dezvoltat dupa acest exemplu

*/
public class FindTest {
	
	
	    public void findFile(String name,File file)
	    {
	        File[] list = file.listFiles();
	        if(list!=null)
	        for (File fil : list)
	        {
	            if (fil.isDirectory())
	            {
	                findFile(name,fil);
	            }
	            else if (name.equalsIgnoreCase(fil.getName()))
	            {
	                System.out.println(fil.getParentFile());
	            }
	        }
	    }
	    public static void main(String[] args) 
	    {
	    	FindTest ff = new FindTest();
	        Scanner scan = new Scanner(System.in);
	        System.out.println("Enter the file to be searched.. " );
	        String name = scan.next();
	        System.out.println("Enter the directory where to search ");
	        String directory = scan.next();
	        ff.findFile(name,new File(directory));
	        scan.close();
	    }
	}


